﻿using LD.BC;
using LD.Host;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LD.Tool
{
    public partial class ToolUSBScanerFrm : FrmToolBase
    {
        public ToolUSBScanerFrm()
        {
            InitializeComponent();
            this.Shown += ToolMoveFrm_Shown;
            this.btn_ok.Click += Btn_ok_Click;
        }

        private void Btn_ok_Click(object sender, EventArgs e)
        {
            this.TB_Tool.Param = this.sw_onoff.Checked.ToString();
        }

        private void ToolMoveFrm_Shown(object sender, EventArgs e)
        {
            Init();
        }
        private void Init()
        {
            if (this.TB_Tool.Param == null) return;

            this.sw_onoff.Checked = Convert.ToBoolean(this.TB_Tool.Param);
        }

        private void sw_onoff_CheckedChanged(object sender, EventArgs e)
        {
            if (sw_onoff.Checked)
                this.sw_onoff.Text = "启动";
            else
                this.sw_onoff.Text = "关闭";
        }
    }
}
